import java.util.ArrayList;
import java.util.List;

/**
 * Created with Intellij IDEA.
 * Description;
 * User:墨琦
 * Data:2023-09-11
 * Time:9:06
 */
public class Java_2 {
    public static int mySqrt(int x) {
       int l=0,c=x;

       int nes=0;
       while(l<=c)
       {
           int mid=l+(c-l)/2;
           if(mid*mid<x)
           {
               nes=mid;
               l=mid+1;

           }
           else if(mid*mid>x)
           {
               c=mid-1;
           }
           else {
               nes=mid;
               break;
           }
       }
       return nes;
    }
    public static void main(String[] args) {

        System.out.println(mySqrt(2));
    }
}
